function addEvent(obj, eventName, func){

    if (obj.attachEvent)

    {

    obj.attachEvent("on" + eventName, func);

    }

    else if(obj.addEventListener)

    {

    obj.addEventListener(eventName, func, true);

    }

    else

    {

    obj["on" + eventName] = func;

    }

    }

    addEvent(window, "load", function(e){

        addEvent(document.body, "click", function(e)

        {

	// -------------- cau hinh chung cho cu so pop  --------------------

           var params = 'scrollbars,width=900, height=800';
			var params1 = 'scrollbars,width=500, height=500';
	// -------------- pop 1 --------------------
/*
		   if(document.cookie.indexOf("truongtonpop") == -1)

           {

				document.cookie = "popunder=truongtonpop";				
				var num = Math.floor(Math.random()*3);
				if ( num == 0 )
				{
				var w = window.open("http://matxac.com/ads/index.html",'TruongTon', params);
				}
				if ( num == 1 )
				{
				var w = window.open("http://matxac.com/ads/index.html",'TruongTon', params);	
				}
				if ( num == 2 )
				{
				var w = window.open("http://matxac.com/ads/index.html",'TruongTon', params);	
				}
					
				if (w)

				{

					document.cookie = "popunder=truongtonpop";

					w.blur();			

				}

				window.focus();

           }
		 
*/
		 // -------------- pop 2 --------------------

		   if(document.cookie.indexOf("hayso1pop") == -1)

           {							
				var w = window.open("http://cucre.baokim.vn/vn/baokim.html?utm_source=matxac.com&utm_medium=referral&utm_campaign=tnt",'baokim', params);


				if (w)

				{

					document.cookie = "popunder2=hayso1pop";

					w.blur();

				}					

				window.focus();

		   }

		 // -------------- pop 3 --------------------
 /*
		if(document.cookie.indexOf("pop3") == -1)

           {							
				var w = window.open("http://matxac.com/ads/index.html",'hayso1', params);


				if (w)

				{

					document.cookie = "popunder3=pop3";

					w.blur();

				}					

				window.focus();

		   }
		  
		if(document.cookie.indexOf("pop4") == -1)

           {							
				var w = window.open("http://trieutulong.com",'trieutulong', params);


				if (w)

				{

					document.cookie = "popunder4=pop4";

					w.blur();

				}					

				window.focus();

		   }

		*/

		// -------------------- het-----------------

        });



    });